
* File to normalize game scores

***Inputs:
* $Data/GameUserISDWeatherPollution_daily.dta

***Output:
* $Data/GameUserWPdaily_norm.dta


use $Data/GameUserISDWeatherPollution_daily.dta, clear


levelsof gamenum

local gamelist  = r(levels)
	
	gen norm_score =.
	gen std_score = .
	
	
	foreach g in `gamelist' {
	
	summ score_raw if gamenum ==`g'
	local mu = r(mean)
	local sigma= r(sd)
	
	replace norm_score = ((score_raw - `mu')/`sigma') if gamenum==`g'
	
	
	replace std_score = (score_raw/`sigma') if gamenum==`g'
	
	
	}
	

	
	
	label variable norm_score "Normalized score"
	label variable std_score "Standardized score"
	
	save $Data/GameUserWPdaily_norm.dta, replace
					
				
